package com.app.conf;

import com.app.util.BizException;
import com.app.util.Result;
import com.app.enums.StatusCodeEnum;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExcrptionHandler {

    private static final Logger logger = LoggerFactory.getLogger(GlobalExcrptionHandler.class);

    @ExceptionHandler(Exception.class)
    public Object Exception(Exception e) {
        e.printStackTrace();

        return Result.error(StatusCodeEnum.STATUS500.getCode(), "系统异常");
    }
}
